@extends('admin_system.layout.layout')
@section('content')
    <br>
    <div class="container">
        <div class="list-group">
            <a href="#" class="list-group-item active">
                <h4 class="list-group-item-heading">言图 <i class="fa fa-picture-o"></i></h4>
                <p class="list-group-item-text">列表</p>
            </a>
        </div>
        <table class="table table-bordered table-hover">
            <thead>
            <tr>
                <th>ID</th>
                <th>书名</th>
                <th>内容</th>
                <th>背景图片</th>
                <th>发布时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            @foreach($data as $k=>$v)
                <tr>
                    <td>{{$v->id}}</td>
                    <td style="max-width: 60px">{{$v->book_name}}</td>
                    <td style="max-width: 160px">{{$v->content}}</td>
                    <td style="padding: 0px;width: 200px">
                        <img src="{{asset($v->bg_img)}}" alt="" style="width: 200px;" readonly>
                    </td>
                    <td>
                        <input type="date" value="{{$v->publish_date}}" class="form-control">
                    </td>
                    <td style="min-width: 150px;">
                        <div class="btn-group">
                            <button type="button" class="btn btn-info">
                                <a href="{{route('delSpeak',['id'=>$v->id])}}">删除</a>
                            </button>
                            <button type="button" class="btn btn-danger">
                                <a href="{{route('editSpeak',['id'=>$v->id])}}">编辑</a>
                            </button>
                        </div>
                    </td>
                </tr>
            @endforeach
            </tbody>
        </table>
        {{$data->links()}}

        <div class="clearfix"></div>
        <div class="btn-group col-md-3" style="padding: 0px">
            <button type="button" id="showAddSpeak" class="btn btn-danger col-md-12">添加</button>
            @include('admin_system.speakImg.speakAddModal')
        </div>
    </div>
    <script>
        $('#showAddSpeak').on('click', function () {
            $('#speakAdd').modal('show');
        })

        @if(session('speakSuccess'))
        swal("Oops...", "{{session('speakSuccess')}}", "success");
        @endif

        @if($errors->has('speakError'))
        swal("Oops...", "{{$errors->first('speakError')}}", "error");
        @endif

    </script>
@stop